<script setup lang="ts">
    import {onMounted, onUnmounted, ref} from 'vue'
    //@ts-ignore
    import moment from 'moment'
    let time = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'))
    let timer = ref(null)
    onMounted(() => {
       timer.value = setInterval(() => {
            time.value = moment().format('YYYY年MM月DD日 hh:mm:ss')
            console.log(8888);
        }, 1000)
    })

    onUnmounted(() => {
        timer.value && clearInterval(timer.value)
    })
</script>

<template>
    <div class="top">
        <div class="left">
            <span class="lbtn" @click="$router.push('/home')">首页</span>
        </div>
        <div class="center">
            <div class="title">智慧旅游可视化大数据平台</div>
        </div>
        <div class="right">
            <span class="rbtn">统计报告</span>
            <span class="time">{{time}}</span>
        </div>
    </div>
</template>

<style scoped lang="scss">
    .top {
    display: flex;
    .left {
        display: flex;
        justify-content: end;
        flex: 1.5;
        background: url('@/views/screen/images/dataScreen-header-left-bg.png') no-repeat;
            background-size: cover;
        .lbtn{
            width: 150px;
            height: 40px;
            background: url('@/views/screen/images/dataScreen-header-btn-bg-l.png') no-repeat;
            text-align: center;
            line-height: 40px;
            color: #29fcff;
            background-size: 100% 100%;
            font-size: 20px;
        }
    }
    .center {
        flex: 2;
        .title{
            background: url('@/views/screen/images/dataScreen-header-center-bg.png') no-repeat;
            background-size: 100% 100%;
            height: 74px;
            font-size: 30px;
            text-align: center;
            color: #29fcff;
            line-height: 74px;
        }
    }
    .right {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex: 1.5;
        background: url('@/views/screen/images/dataScreen-header-right-bg.png') no-repeat;
        background-size: cover;
        .rbtn{
            width: 150px;
            height: 40px;
            background: url('@/views/screen/images/dataScreen-header-btn-bg-r.png') no-repeat;
            line-height: 40px;
            color: #29fcff;
            background-size: 100% 100%;
            text-align: center;
            font-size: 20px;
        }
        .time{
            color: #29fcff;
            font-size: 20px;
        }
    }
    }
</style>
